package cn.yunhe.services;

import cn.yunhe.dao.ITypeDaoMapper;
import cn.yunhe.entity.merchantsentity.Type;
import cn.yunhe.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;
/**
 * 周依博
 */
public class AddTypeService {

    public int addType(Type type){
        SqlSession session = SqlSessionFactoryUtil.getSqlSession();
        ITypeDaoMapper typeDaoMapper = session.getMapper(ITypeDaoMapper.class);
        int result=0;
        if (type!=null){
            try{
                result= typeDaoMapper.addType(type);
                session.commit();

            }finally {
                session.close();
            }
        }
        return result;


    }
}
